from django.contrib.auth.models import User

#all utitlity methods used in this app

def detail_context_render(reviews=None):
    """
    This method is used to render the context for reviews list
    That is to set the context in the form below
    
    [
        {
            reviewer : 'username1',
            body : 'lorem ipsum ...',
            
        },
        {
            reviewer : 'username2',
            body : 'lorem ipsum ...',
        }, ...
    ]
    
    """
    rendered = []
    for review in reviews:
        block = {}
        block['reviewer'] = 'reviewer s username'
        block['datetime'] = 'review date-time'
        block['body'] = review.body
        # render datetime
        rendered.append(block)
    return rendered